# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-randomly
pkgver=3.12.0
pkgrel=2
pkgdesc='Pytest plugin to randomly order tests and control random.seed'
arch=('any')
license=('MIT')
url='https://github.com/pytest-dev/pytest-randomly'
depends=('python-importlib-metadata' 'python-pytest')
makedepends=('python-setuptools')
checkdepends=('python-factory-boy' 'python-faker' 'python-numpy' 'python-pytest-xdist')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pytest-dev/pytest-randomly/archive/$pkgver.tar.gz"
        $pkgname-pytest-7.3.patch)
sha512sums=('e2241c1304b9597f93cc57d6830808f85c59ea1b4815624dcd9d088f87eb4a34d6cb6394de9c31ebedcb8280fb6ff12b110fd5a559ab28c9e0381481fce52c4d'
            '31a70171bd74ad21c94516fa0110878f12f6dade861bdb7c0e52ebbc39f28a7929543041303bfc29d1011414a8ce347edfa95a5dfdadcd202dc2924d4390d984')

prepare() {
  cd pytest-randomly-$pkgver
  patch -p1 -i ../$pkgname-pytest-7.3.patch
}

build() {
  cd pytest-randomly-$pkgver
  python setup.py build
}

check() {
  cd pytest-randomly-$pkgver
  # TODO: Understand why...
  PYTHONPATH="$PWD/src" pytest --deselect tests/test_pytest_randomly.py::test_entrypoint_injection
}

package() {
  cd pytest-randomly-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
